function setTime(){
    let arr = [1,2,3,4,5]
    let length = arr.length
    let timer = function(){
        return new Promise((resolve)=>{
            let res = arr.shift()
            resolve(res)
        })
    }
    let get = function (){
        timer().then(res=>{
            console.log(res)
            setTimeout(()=>{
                if (arr.length > 0) {
                    get()
                }
            }, (length - arr.length)  * 1000)
        })
    }
    get()
}
setTime()